<template>
  <div>
    <TopFilter :list="topFilterList" :cols="1" @filterChange="changeHandle" @onCollapse="collapseHandle" />
    <FilterTable
      ref="selectAssignModelTable"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      columnsRef="selectAssignModelTable"
      selectionType="single"
      height="350"
      :datakey="'rows'"
      :onRowSelectChange="columns => (this.partColumns = columns)"
      :onColumnsChange="columns => (this.columns = columns)"
    />

    <div style="text-align:center;">
      <el-button size="small" type="primary" @click="clickOk">确定</el-button>
      <el-button size="small" type="primary" @click="closePage">取消</el-button>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { queryTechnicians } from '@/api/repair/repairAssign/repairAssign';
export default {
  name: 'selectAssignModel',
  mixins: [dictionary],
  data() {
    return {
      topFilterList: this.createTopFilterList(),
      fetchParams: {},
      columns: this.createTableColumns(),
      fetchApi: queryRepairAssign,
      itemPart: false,
      completed: false,
      roAssignAll: false,
      roAssign: false,
      closeAssign: false,
      waitTag: 10041001,
      partTag: 10041001,
      repairAssignTagTiatle: '等待答复',
      repairAssignPartTatle: '等待配件',
      completedTatle: '竣工',
      partColumns: []
    };
  },
  mounted() {
    this.BaseTable = this.$refs.selectAssignModelTable.$refs.pageTable;
  },
  methods: {
    // 查询条件
    createTopFilterList() {
      return [
        {
          type: 'INPUT',
          label: '技师姓名',
          fieldName: 'techniCode',
          placeholder: '请输入技师姓名'
        }
      ];
    },
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 70,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '员工编号',
          dataIndex: 'TECHNICIAN',
          sorter: true,
          filter: true,
          width: 110,
          filterType: 'input'
        },
        {
          title: '员工姓名',
          dataIndex: 'EMPLOYEE_NAME',
          sorter: true,
          filter: true,
          filterType: 'input'
        },
        {
          title: '在修派工工时',
          dataIndex: 'ASSIGN_LABOUR_HOUR',
          sorter: true,
          filter: true,
          width: 150,
          filterType: 'input'
        }
      ];
    },

    changeHandle(val) {
      this.fetchParams = Object.assign({}, val, { xhrAbort: false });
    },
    collapseHandle() {
      this.$nextTick(() => {
        this.BaseTable.EXECUTE_RESET_HEIGHT();
      });
    },
    clickOk() {},
    closePage() {
      this.$emit('close');
    }
  }
};
</script>

<style lang="less" scoped></style>
